/**
 * Created by Administrator on 15-3-30.
 */
var http = require("http");
var express = require("express");
var path = require("path");


//初session始化
var app = express();

//设置我的静态资源存放的位置(它会自动寻找index文件)
app.use(express.static(__dirname,"/public"));
//设置控制台的输出记录
app.use(express.logger("dev"));

//设置开发者环境
app.use(express.methodOverride());
//设置cookie和session中间件
app.use(express.cookieParser());
app.use(express.session({secret:'test'}));
//设置post取值中间件
app.use(express.bodyParser());
//设置路由
app.use(app.router);
//设置网站静态路径
app.use(express.static(path.join(__dirname ,"/public")));
if('development'== app.get("env")){
    app.use(express.errorHandler());
}
//创建服务器
http.createServer(app).listen(8002,function(){
    console.log("服务启动成功!端口为" + 8002);
});
//引入文件......
app.get("/",function(){});






